| Print a duck.
| Assemble for Minix with As86.
| Written by Casey Stone. Public domain.
	.sect	.bss
	.comm	msg, 24

	.sect	.rdata
	.word	5
picture:
	.ascii	"  __\n"

	.sect	.text
	.globl	put
put:
	mov	bp, sp
	mov	byte ptr [msg + 2], #4	| WRITE system call
	mov	[msg + 4], #1	| Standard output
	mov	bx, [bp + 2]
	mov	[msg + 10], bx	| string
	mov	ax, [bx - 2]
	mov	[msg + 6], ax	| length
	mov	ax, #1		| ax = FS (== 1)
	mov	bx, msg
	mov	cx, #3		| BOTH == 3. sendrec(srcdest, ptr)
	int	#32
	test	ax, ax
	jnz	put.return	| sendrec() itself has failed
	or	ax, [msg + 2]	| return value
put.return:
	ret

	.globl	start
start:
	push	[picture]
	call	put
	test	ax, ax
	jz	start.success
	mov	ax, 1
start.success:
	mov	[msg + 4], ax	| exit status
	mov	byte ptr [msg + 2], #1	| EXIT system call
	xor	ax, ax		| as = MM (== 0)
	mov	bx, msg
	mov	cx, #3		| BOTH == 3. sendrec(srcdest, ptr)
	int	#32		| trap to the kernel
	hlt			| force a trap if exit fails
